
object ScalaClass{

}


// 默认构造函数
class Class(var param: String = null) {

    var double: Double = _
    private var field: String = param
    protected var int: Int = _

    // 辅助构造函数
    def this(param: String, double: Double) {
        // 调用默认构造函数
        this(param)
        this.double = double
    }

    def method(name: String): String = {
        println(double)
        var str: String = private_method(name)
        return str
    }

    private def private_method(name: String): String = {
        println(field)
        return field
    }
}


object Class {
    // 伴生对象：static成员和方法

    var static: String = ""

    def apply(param: String) = new Class(param)
}